package com.genexususa.eo.bing.test.set;

import com.genexususa.eo.bing.connection.KeywordManager;
import com.genexususa.eo.bing.test.TestUtil;

public class ConsumeSetDestinationUrlToKeywords {
    public static void main(String[] args) {
        TestUtil testUtil = new TestUtil();
        String keywordDestinationUrlsRequestsXML =  "<Bing_KeywordDestinationUrlsRequestCollection xmlns=\"L2TMediaDev\">\n" +
                                                        "\t<Bing_KeywordDestinationUrlsRequest xmlns=\"L2TMediaDev\">\n" +
                                                            "\t\t<GxCampaignId>45616011</GxCampaignId>\n" +
                                                            "\t\t<BingCampaignId>" + testUtil.campaignId1 + "</BingCampaignId>\n" +
                                                            "\t\t<KeywordDestinationUrlsAdGroupRequestCollection>\n" +
                                                                "\t\t\t<KeywordDestinationUrlsAdGroupRequest>\n" +
                                                                    "\t\t\t\t<GxAdGroupId>452315612</GxAdGroupId>\n" +
                                                                    "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup11 + "</BingAdGroupId>\n" +
                                                                    "\t\t\t\t<KeywordDestinationUrlCollection>\n" +
                                                                        "\t\t\t\t\t<KeywordDestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<DestinationUrl xmlns=\"https://adcenter.microsoft.com/v8\">www.hola.com</DestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891652</GxKeywordId>\n" +
                                                                            "\t\t\t\t\t\t<BingKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.keywordId111 + "</BingKeywordId>\n" +
                                                                        "\t\t\t\t\t</KeywordDestinationUrl>\n" +
                                                                        "\t\t\t\t\t<KeywordDestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<DestinationUrl xmlns=\"https://adcenter.microsoft.com/v8\">www.chau.com</DestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891653</GxKeywordId>\n" +
                                                                            "\t\t\t\t\t\t<BingKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.keywordId112 + "</BingKeywordId>\n" +
                                                                        "\t\t\t\t\t</KeywordDestinationUrl>\n" +
                                                                    "\t\t\t\t</KeywordDestinationUrlCollection>\n" +
                                                                "\t\t\t</KeywordDestinationUrlsAdGroupRequest>\n" +
                                                            "\t\t</KeywordDestinationUrlsAdGroupRequestCollection>\n" +
                                                        "\t</Bing_KeywordDestinationUrlsRequest>\n" +
                                                        "\t<Bing_KeywordDestinationUrlsRequest xmlns=\"L2TMediaDev\">\n" +
                                                            "\t\t<GxCampaignId>45616012</GxCampaignId>\n" +
                                                            "\t\t<BingCampaignId>" + testUtil.campaignId2 + "</BingCampaignId>\n" +
                                                            "\t\t<KeywordDestinationUrlsAdGroupRequestCollection>\n" +
                                                                "\t\t\t<KeywordDestinationUrlsAdGroupRequest>\n" +
                                                                    "\t\t\t\t<GxAdGroupId>452315613</GxAdGroupId>\n" +
                                                                    "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup21 + "</BingAdGroupId>\n" +
                                                                    "\t\t\t\t<KeywordDestinationUrlCollection>\n" +
                                                                        "\t\t\t\t\t<KeywordDestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<DestinationUrl xmlns=\"https://adcenter.microsoft.com/v8\">www.otra.com</DestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891652</GxKeywordId>\n" +
                                                                            "\t\t\t\t\t\t<BingKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.keywordId211 + "</BingKeywordId>\n" +
                                                                        "\t\t\t\t\t</KeywordDestinationUrl>\n" +
                                                                    "\t\t\t\t</KeywordDestinationUrlCollection>\n" +
                                                                "\t\t\t</KeywordDestinationUrlsAdGroupRequest>\n" +
                                                                "\t\t\t<KeywordDestinationUrlsAdGroupRequest>\n" +
                                                                    "\t\t\t\t<GxAdGroupId>452315614</GxAdGroupId>\n" +
                                                                    "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup22 + "</BingAdGroupId>\n" +
                                                                    "\t\t\t\t<KeywordDestinationUrlCollection>\n" +
                                                                        "\t\t\t\t\t<KeywordDestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<DestinationUrl xmlns=\"https://adcenter.microsoft.com/v8\">www.otradir.com</DestinationUrl>\n" +
                                                                            "\t\t\t\t\t\t<GxKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">4564891653</GxKeywordId>\n" +
                                                                            "\t\t\t\t\t\t<BingKeywordId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.keywordId221 + "</BingKeywordId>\n" +
                                                                        "\t\t\t\t\t</KeywordDestinationUrl>\n" +
                                                                    "\t\t\t\t</KeywordDestinationUrlCollection>\n" +
                                                                "\t\t\t</KeywordDestinationUrlsAdGroupRequest>\n" +
                                                            "\t\t</KeywordDestinationUrlsAdGroupRequestCollection>\n" +
                                                        "\t</Bing_KeywordDestinationUrlsRequest>\n" +
                                                    "</Bing_KeywordDestinationUrlsRequestCollection>\n";
        KeywordManager resource = new KeywordManager();
        System.out.println("Consuming SetDestinationUrlToKeywords.....");
        String userName = testUtil.userName;
        String password = testUtil.password;
        String developerToken = testUtil.developerToken;
        long customerId = testUtil.customerId;
        long customerAccountId = testUtil.customerAccountId;
        String applicationId = testUtil.applicationId;
        //String result = resource.setDestinationUrlToKeywords(userName, password, developerToken, customerId, customerAccountId, applicationId, keywordDestinationUrlsRequestsXML);
        String result = resource.updateKeywords(customerAccountId, keywordDestinationUrlsRequestsXML);
        System.out.println("Result:\n" + result);
    }
}
